﻿@model IEnumerable<IRIS.Models.StaticPage>

@{
    ViewBag.Title = "Index";
}

@section SubMenu
{
    <ul id="submenu">
    @foreach(var item in Model)
    {
        <li>@Html.ActionLink(item.Title, "Details", new { id = item.Id })
        </li>
    }
    </ul>

}
@if (Model.Count() > 0)
{
    <table>
        <tr>
            <th>
                Nafn
            </th>
            <th>
                Dagsetning 
            </th>
            <th>
                Síðast breytt
            </th>
       
             @if (User.IsInRole("Stjórnendur"))
             {
                <th>
                    Stjórnborð
                </th>
             }
        </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.ActionLink(item.Title, "Details", new { id = item.Id })
            </td>
            <td>
                @item.Created.ToShortDateString()
            </td>
            <td>
                @item.Modified.ToShortDateString()
            </td>
               @if (User.IsInRole("Stjórnendur"))
               {
                <td>
                    @Html.ActionLink("Breyta", "Edit", new { id = item.Id, delete = false }) |            
                    @Html.ActionLink("Eyða", "Edit", new { id = item.Id, delete = true })
            
                </td>
               }
        </tr>
    }
    </table>
}
else
{
    <p>Engar undirsíður haf verið gerðar.</p>
}